package com.ls.pattern.flyweight.poker;

import java.util.Collections;
import java.util.List;

/**
 * 发牌器
 */
public class Shuffler {

    public static void deal(List<Player> playerList) {
        List<Poker> pokers = PokerFactory.createPokers();
        // 打乱牌堆
        Collections.shuffle(pokers);

        // 每人发3张牌
        for (int i = 0; i < 3; i++) {
            for (Player player : playerList) {
                player.addPoker(pokers.remove(0));
            }
        }

    }
}
